<?php
class model_fetion {
	/**
	 * 发送飞信 (内部函数)
	 */
	private function _send($to, $content, $from, $password) {
		//$url = "http://sms.api.bz/fetion.php?username=$from&password=$password&sendto=$to&message=$content";  
		//$url = "http://fetion.adwap.cn/restlet/fetion/$from/$password/$to/$content";  
		//$url = "http://99juhui.com/fetion/toself.php?username=$from&password=$password&message=$content";
        require_once ROOT.'/library/phpfetion/PHPFetion.php';

        $fetion = new PHPFetion($from, $password);
        $ret = $fetion->send($to, $content);

		return $ret;
	}
	
	/**
	 * 发送飞信接口
	 * @param string $to
	 * @param string $content
	 * @return string
	 */
	public function send($content, $to = '') {
		$model_var = new model_var();
		$from = $model_var->get('fetion_from');
		$password = $model_var->get('fetion_from_password');
		$to = empty($to) ? $from : $to;
		if(empty($content)) {
			return false;
		}
		
		return $this->_send($to, $content, $from, $password);
	}
}
